﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mitasoft.Books.Services
{
    internal class ApplicationMessagesService
    {
        public event EventHandler OnMessageAdded;
        private Stack<string> messageStack;

        public ApplicationMessagesService()
        {
            messageStack = new Stack<string>();
        }

        public void AddMessage(string message)
        {
            messageStack.Push(message);
            ApplicationMessageEventArgs ee = new ApplicationMessageEventArgs { Messages = messageStack.ToList() };

            if (OnMessageAdded != null)
            {
                OnMessageAdded(this, ee);
            }
        }

    }

    internal class ApplicationMessageEventArgs : EventArgs
    {

        public List<string> Messages { get; set; }

        public ApplicationMessageEventArgs()
        {

        }

    }
}
